{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import math\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "headers = [\"buying\", \"maint\", \"doors\", \"persons\",\"lug_boot\", \"safety\", \"class\"]\n",
    "data = pd.read_csv(\"car_data.csv\", header=None, names=headers)\n",
    "\n",
    "data = data.sample(frac=1).reset_index(drop=True) # shuffle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "for h in headers:\n",
    "    data[h] = data[h].astype('category')\n",
    "    data[h] = data[h].cat.codes\n",
    "\n",
    "data.set_index(\"class\", inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "size = len(data)\n",
    "train_size = int(math.floor(size * 0.7))\n",
    "train_data = data[:train_size]\n",
    "test_data = data[train_size:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(class_weight=None, criterion='gini', max_depth=None,\n",
       "            max_features=None, max_leaf_nodes=None,\n",
       "            min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "            min_samples_leaf=1, min_samples_split=2,\n",
       "            min_weight_fraction_leaf=0.0, presort=False, random_state=None,\n",
       "            splitter='best')"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d_tree = DecisionTreeClassifier(criterion=\"gini\")\n",
    "d_tree.fit(train_data, train_data.index) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.97109826589595372"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d_tree.predict(test_data.iloc[:, 0:6])\n",
    "d_tree.score(test_data, test_data.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(class_weight=None, criterion='entropy', max_depth=None,\n",
       "            max_features=None, max_leaf_nodes=None,\n",
       "            min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "            min_samples_leaf=1, min_samples_split=2,\n",
       "            min_weight_fraction_leaf=0.0, presort=False, random_state=None,\n",
       "            splitter='best')"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d_tree2 = DecisionTreeClassifier(criterion=\"entropy\")\n",
    "d_tree2.fit(train_data, train_data.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.98843930635838151"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d_tree2.predict(test_data.iloc[:, 0:6])\n",
    "d_tree2.score(test_data, test_data.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "\n",
    "def score_per_estimators(n_estimators, train_data, test_data):\n",
    "    scores = []\n",
    "    for i in range(1, n_estimators):\n",
    "        RF = RandomForestClassifier(n_estimators=i, criterion=\"entropy\")\n",
    "        RF.fit(train_data, train_data.index)\n",
    "        \n",
    "        RF.predict(test_data.iloc[:, 0:6])\n",
    "        score = RF.score(test_data, test_data.index)\n",
    "        scores.append(score)\n",
    "        \n",
    "    return scores"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiA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lVj3R0fYKlnuty1fdWH7eEfjbQP+B1CpDbQXUJOlXN9f9zP/AavuYst9jnb1+tbWfd38H1CQpV3aeq1apaAzxFF/7ORCQcXzC+qKqL/Lu7/PdW33W56XtriFtCfyUwXEQGi0gEcBWwuIPrFBQi0t3f0YSIdAcuANY3/q4uZTFwvX/7euCNDqxL0NQGot9ldNHvTEQE+DuwSVX/GHCoS39vDV2XW763xrhi9A6Af2jVI0AYsEBV7+/gKgWFiAzBd3cP4AX+0VWvTUReAqbiW81wH3AP8DrwMjAA2ANcqapdqlO0geuaiq+JQIFdwPdr28C7EhE5A/gIWAfU+Hffga/9u8t+b41c12xc8L01xjWhb4wxpmluad4xxhjjgIW+McaEEAt9Y4wJIRb6xhgTQiz0jTEmhFjoG2NMCLHQN8aYEGKhb4wxIeT/A+10bEj4EhacAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8f6011e710>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "scores = score_per_estimators(30, train_data, test_data)\n",
    "\n",
    "plt.plot(scores)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
